<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" type="text/css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" type="text/css">
    <link rel="stylesheet" href="./resources/prism/prism.css" type="text/css">
    <link rel="stylesheet" href="../css/ol.css" type="text/css">
    <link rel="stylesheet" href="./resources/layout.css" type="text/css">
    
    <link rel="stylesheet" href="blend-modes.css">
    <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch,requestAnimationFrame,Element.prototype.classList,URL"></script>
    <script src="./resources/zeroclipboard/ZeroClipboard.min.js"></script>
    <title>Blend Modes</title>
  </head>
  <body>

    <header class="navbar" role="navigation">
      <div class="container">
        <div class="display-table pull-left" id="navbar-logo-container">
          <a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png">&nbsp;OpenLayers Examples</a>
        </div>
        <!-- menu items that get hidden below 768px width -->
        <nav class='collapse navbar-collapse navbar-responsive-collapse'>
          <ul class="nav navbar-nav pull-right">
            <li><a href="../doc">Docs</a></li>
            <li><a class="active" href="index.html">Examples</a></li>
            <li><a href="../apidoc">API</a></li>
            <li><a href="https://github.com/openlayers/openlayers">Code</a></li>
          </ul>
        </nav>
      </div>
    </header>

    <div class="container-fluid">

      <div id="latest-check" class="alert alert-warning alert-dismissible" role="alert" style="display:none">
        <button id="latest-dismiss" type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        This example uses OpenLayers v<span>4.6.5</span>. The <a id="latest-link" href="#" class="alert-link">latest</a> is v<span id="latest-version"></span>.
      </div>

      <div class="row-fluid">
        <div class="span12">
          <h4 id="title">Blend Modes</h4>
          <div id="map" class="map"></div>
<form class="form-horizontal">
  <label>
    <select id="blend-mode" class="form-control">
      <option value="source-over">source-over (default)</option>
      <option>source-in</option>
      <option>source-out</option>
      <option>source-atop</option>
      <option>destination-over</option>
      <option>destination-in</option>
      <option>destination-out</option>
      <option>destination-atop</option>
      <option>lighter</option>
      <option>copy</option>
      <option>xor</option>
      <option>multiply</option>
      <option>screen</option>
      <option>overlay</option>
      <option>darken</option>
      <option>lighten</option>
      <option>color-dodge</option>
      <option>color-burn</option>
      <option>hard-light</option>
      <option>soft-light</option>
      <option selected>difference</option>
      <option>exclusion</option>
      <option>hue</option>
      <option>saturation</option>
      <option>color</option>
      <option>luminosity</option>
    </select>
    Canvas compositing / blending mode
  </label>
  <label>
    <input type="checkbox" id="affect-red" checked>
    Red circle affected
  </label>
  <label>
    <input type="checkbox" id="affect-green" checked>
    Green circle affected
  </label>
  <label>
    <input type="checkbox" id="affect-blue" checked>
    Blue circle affected
  </label>
</form>

        </div>
      </div>

      <div class="row-fluid">
        <div class="span12">
          <p id="shortdesc">Shows how to change the canvas compositing / blending mode in post- and precompose eventhandlers.</p>
          <div id="docs"><p>This example shows how to change the canvas compositing / blending mode in post- and precompose event handlers. The Canvas 2D API provides the property <code>globalCompositeOperation</code> with which one can influence which composition operation will be used when drawing on the canvas. The various options are well described on the <a href="https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation">MDN documentation page</a>.</p>
<p>In this example three circles on the corners of an equilateral triangle are drawn with red, green or blue styles respectively. By setting the <code>globalCompositeOperation</code> you can change how these colors turn out when they are combined on the map.</p>
<p>You can select an operation in the select-field and you can also control which layers will be affected by the chosen operation through the layer checkboxes.</p>
</div>
          <div id="api-links">Related API documentation: <ul class="inline"><li><a href="../apidoc/ol.Feature.html" title="API documentation for ol.Feature">ol.Feature</a></li>,<li><a href="../apidoc/ol.Map.html" title="API documentation for ol.Map">ol.Map</a></li>,<li><a href="../apidoc/ol.View.html" title="API documentation for ol.View">ol.View</a></li>,<li><a href="../apidoc/ol.geom.Point.html" title="API documentation for ol.geom.Point">ol.geom.Point</a></li>,<li><a href="../apidoc/ol.layer.Vector.html" title="API documentation for ol.layer.Vector">ol.layer.Vector</a></li>,<li><a href="../apidoc/ol.source.Vector.html" title="API documentation for ol.source.Vector">ol.source.Vector</a></li>,<li><a href="../apidoc/ol.style.Circle.html" title="API documentation for ol.style.Circle">ol.style.Circle</a></li>,<li><a href="../apidoc/ol.style.Fill.html" title="API documentation for ol.style.Fill">ol.style.Fill</a></li>,<li><a href="../apidoc/ol.style.Stroke.html" title="API documentation for ol.style.Stroke">ol.style.Stroke</a></li>,<li><a href="../apidoc/ol.style.Style.html" title="API documentation for ol.style.Style">ol.style.Style</a></li></ul></div>
        </div>
      </div>

      <div class="row-fluid">
        <div id="source-controls">
          <a id="copy-button"><i class="fa fa-clipboard"></i> Copy</a>
          <a id="codepen-button"><i class="fa fa-codepen"></i> Edit</a>
        </div>
        <form method="POST" id="codepen-form" target="_blank" action="https://codepen.io/pen/define/">
          <textarea class="hidden" name="title">Blend Modes</textarea>
          <textarea class="hidden" name="description">Shows how to change the canvas compositing / blending mode in post- and precompose eventhandlers.</textarea>
          <textarea class="hidden" name="js">// Create separate layers for red, green an blue circles.
//
// Every layer has one feature that is styled with a circle, together the
// features form the corners of an equilateral triangle and their styles overlap
var redLayer &#x3D; new ol.layer.Vector({
  source: new ol.source.Vector({
    features: [new ol.Feature(new ol.geom.Point([0, 0]))]
  }),
  style: new ol.style.Style({
    image: new ol.style.Circle({
      fill: new ol.style.Fill({
        color: &#x27;rgba(255,0,0,0.8)&#x27;
      }),
      stroke: new ol.style.Stroke({
        color: &#x27;rgb(255,0,0)&#x27;,
        width: 15
      }),
      radius: 120
    })
  })
});
var greenLayer &#x3D; new ol.layer.Vector({
  source: new ol.source.Vector({
    // 433.013 is roughly 250 * Math.sqrt(3)
    features: [new ol.Feature(new ol.geom.Point([250, 433.013]))]
  }),
  style: new ol.style.Style({
    image: new ol.style.Circle({
      fill: new ol.style.Fill({
        color: &#x27;rgba(0,255,0,0.8)&#x27;
      }),
      stroke: new ol.style.Stroke({
        color: &#x27;rgb(0,255,0)&#x27;,
        width: 15
      }),
      radius: 120
    })
  })
});
var blueLayer &#x3D; new ol.layer.Vector({
  source: new ol.source.Vector({
    features: [new ol.Feature(new ol.geom.Point([500, 0]))]
  }),
  style: new ol.style.Style({
    image: new ol.style.Circle({
      fill: new ol.style.Fill({
        color: &#x27;rgba(0,0,255,0.8)&#x27;
      }),
      stroke: new ol.style.Stroke({
        color: &#x27;rgb(0,0,255)&#x27;,
        width: 15
      }),
      radius: 120
    })
  })
});

// Create the map, the view is centered on the triangle. Zooming and panning is
// restricted to a sane area
var map &#x3D; new ol.Map({
  layers: [
    redLayer,
    greenLayer,
    blueLayer
  ],
  target: &#x27;map&#x27;,
  view: new ol.View({
    center: [250, 220],
    extent: [0, 0, 500, 500],
    resolution: 4,
    minResolution: 2,
    maxResolution: 32
  })
});

// Get the form elements and bind the listeners
var select &#x3D; document.getElementById(&#x27;blend-mode&#x27;);
var affectRed &#x3D; document.getElementById(&#x27;affect-red&#x27;);
var affectGreen &#x3D; document.getElementById(&#x27;affect-green&#x27;);
var affectBlue &#x3D; document.getElementById(&#x27;affect-blue&#x27;);


/**
 * This method sets the globalCompositeOperation to the value of the select
 * field and it is bound to the precompose event of the layers.
 *
 * @param {ol.render.Event} evt The render event.
 */
var setBlendModeFromSelect &#x3D; function(evt) {
  evt.context.globalCompositeOperation &#x3D; select.value;
};


/**
 * This method resets the globalCompositeOperation to the default value of
 * &#x27;source-over&#x27; and it is bound to the postcompose event of the layers.
 *
 * @param {ol.render.Event} evt The render event.
 */
var resetBlendModeFromSelect &#x3D; function(evt) {
  evt.context.globalCompositeOperation &#x3D; &#x27;source-over&#x27;;
};


/**
 * Bind the pre- and postcompose handlers to the passed layer.
 *
 * @param {ol.layer.Vector} layer The layer to bind the handlers to.
 */
var bindLayerListeners &#x3D; function(layer) {
  layer.on(&#x27;precompose&#x27;, setBlendModeFromSelect);
  layer.on(&#x27;postcompose&#x27;, resetBlendModeFromSelect);
};


/**
 * Unind the pre- and postcompose handlers to the passed layers.
 *
 * @param {ol.layer.Vector} layer The layer to unbind the handlers from.
 */
var unbindLayerListeners &#x3D; function(layer) {
  layer.un(&#x27;precompose&#x27;, setBlendModeFromSelect);
  layer.un(&#x27;postcompose&#x27;, resetBlendModeFromSelect);
};


/**
 * Handler for the click event of the &#x27;affect-XXX&#x27; checkboxes.
 *
 * @this {HTMLInputElement}
 */
var affectLayerClicked &#x3D; function() {
  var layer;
  if (this.id &#x3D;&#x3D; &#x27;affect-red&#x27;) {
    layer &#x3D; redLayer;
  } else if (this.id &#x3D;&#x3D; &#x27;affect-green&#x27;) {
    layer &#x3D; greenLayer;
  } else {
    layer &#x3D; blueLayer;
  }
  if (this.checked) {
    bindLayerListeners(layer);
  } else {
    unbindLayerListeners(layer);
  }
  map.render();
};


// Rerender map when blend mode changes
select.addEventListener(&#x27;change&#x27;, function() {
  map.render();
});

// Unbind / bind listeners depending on the checked state when the checkboxes
// are clicked
affectRed.addEventListener(&#x27;click&#x27;, affectLayerClicked);
affectGreen.addEventListener(&#x27;click&#x27;, affectLayerClicked);
affectBlue.addEventListener(&#x27;click&#x27;, affectLayerClicked);

// Initially bind listeners
bindLayerListeners(redLayer);
bindLayerListeners(greenLayer);
bindLayerListeners(blueLayer);
</textarea>
          <textarea class="hidden" name="css">.map{
  background-repeat: repeat;
  background-image: url(&#x3D;&#x3D;);
}
</textarea>
          <textarea class="hidden" name="html">&lt;div id&#x3D;&quot;map&quot; class&#x3D;&quot;map&quot;&gt;&lt;/div&gt;
&lt;form class&#x3D;&quot;form-horizontal&quot;&gt;
  &lt;label&gt;
    &lt;select id&#x3D;&quot;blend-mode&quot; class&#x3D;&quot;form-control&quot;&gt;
      &lt;option value&#x3D;&quot;source-over&quot;&gt;source-over (default)&lt;/option&gt;
      &lt;option&gt;source-in&lt;/option&gt;
      &lt;option&gt;source-out&lt;/option&gt;
      &lt;option&gt;source-atop&lt;/option&gt;
      &lt;option&gt;destination-over&lt;/option&gt;
      &lt;option&gt;destination-in&lt;/option&gt;
      &lt;option&gt;destination-out&lt;/option&gt;
      &lt;option&gt;destination-atop&lt;/option&gt;
      &lt;option&gt;lighter&lt;/option&gt;
      &lt;option&gt;copy&lt;/option&gt;
      &lt;option&gt;xor&lt;/option&gt;
      &lt;option&gt;multiply&lt;/option&gt;
      &lt;option&gt;screen&lt;/option&gt;
      &lt;option&gt;overlay&lt;/option&gt;
      &lt;option&gt;darken&lt;/option&gt;
      &lt;option&gt;lighten&lt;/option&gt;
      &lt;option&gt;color-dodge&lt;/option&gt;
      &lt;option&gt;color-burn&lt;/option&gt;
      &lt;option&gt;hard-light&lt;/option&gt;
      &lt;option&gt;soft-light&lt;/option&gt;
      &lt;option selected&gt;difference&lt;/option&gt;
      &lt;option&gt;exclusion&lt;/option&gt;
      &lt;option&gt;hue&lt;/option&gt;
      &lt;option&gt;saturation&lt;/option&gt;
      &lt;option&gt;color&lt;/option&gt;
      &lt;option&gt;luminosity&lt;/option&gt;
    &lt;/select&gt;
    Canvas compositing / blending mode
  &lt;/label&gt;
  &lt;label&gt;
    &lt;input type&#x3D;&quot;checkbox&quot; id&#x3D;&quot;affect-red&quot; checked&gt;
    Red circle affected
  &lt;/label&gt;
  &lt;label&gt;
    &lt;input type&#x3D;&quot;checkbox&quot; id&#x3D;&quot;affect-green&quot; checked&gt;
    Green circle affected
  &lt;/label&gt;
  &lt;label&gt;
    &lt;input type&#x3D;&quot;checkbox&quot; id&#x3D;&quot;affect-blue&quot; checked&gt;
    Blue circle affected
  &lt;/label&gt;
&lt;/form&gt;
</textarea>
          <input type="hidden" name="resources" value="https://openlayers.org/en/v4.6.5/css/ol.css,https://openlayers.org/en/v4.6.5/build/ol.js">
          <input type="hidden" name="data">
        </form>
        <pre><code id="example-source" class="language-markup">&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Blend Modes&lt;/title&gt;
    &lt;link rel="stylesheet" href="https://openlayers.org/en/v4.6.5/css/ol.css" type="text/css"&gt;
    &lt;!-- The line below is only needed for old environments like Internet Explorer and Android 4.x --&gt;
    &lt;script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"&gt;&lt;/script&gt;
    &lt;script src="https://openlayers.org/en/v4.6.5/build/ol.js"&gt;&lt;/script&gt;
    &lt;style&gt;
      .map{
        background-repeat: repeat;
        background-image: url(&#x3D;&#x3D;);
      }
    &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div id&#x3D;&quot;map&quot; class&#x3D;&quot;map&quot;&gt;&lt;/div&gt;
    &lt;form class&#x3D;&quot;form-horizontal&quot;&gt;
      &lt;label&gt;
        &lt;select id&#x3D;&quot;blend-mode&quot; class&#x3D;&quot;form-control&quot;&gt;
          &lt;option value&#x3D;&quot;source-over&quot;&gt;source-over (default)&lt;/option&gt;
          &lt;option&gt;source-in&lt;/option&gt;
          &lt;option&gt;source-out&lt;/option&gt;
          &lt;option&gt;source-atop&lt;/option&gt;
          &lt;option&gt;destination-over&lt;/option&gt;
          &lt;option&gt;destination-in&lt;/option&gt;
          &lt;option&gt;destination-out&lt;/option&gt;
          &lt;option&gt;destination-atop&lt;/option&gt;
          &lt;option&gt;lighter&lt;/option&gt;
          &lt;option&gt;copy&lt;/option&gt;
          &lt;option&gt;xor&lt;/option&gt;
          &lt;option&gt;multiply&lt;/option&gt;
          &lt;option&gt;screen&lt;/option&gt;
          &lt;option&gt;overlay&lt;/option&gt;
          &lt;option&gt;darken&lt;/option&gt;
          &lt;option&gt;lighten&lt;/option&gt;
          &lt;option&gt;color-dodge&lt;/option&gt;
          &lt;option&gt;color-burn&lt;/option&gt;
          &lt;option&gt;hard-light&lt;/option&gt;
          &lt;option&gt;soft-light&lt;/option&gt;
          &lt;option selected&gt;difference&lt;/option&gt;
          &lt;option&gt;exclusion&lt;/option&gt;
          &lt;option&gt;hue&lt;/option&gt;
          &lt;option&gt;saturation&lt;/option&gt;
          &lt;option&gt;color&lt;/option&gt;
          &lt;option&gt;luminosity&lt;/option&gt;
        &lt;/select&gt;
        Canvas compositing / blending mode
      &lt;/label&gt;
      &lt;label&gt;
        &lt;input type&#x3D;&quot;checkbox&quot; id&#x3D;&quot;affect-red&quot; checked&gt;
        Red circle affected
      &lt;/label&gt;
      &lt;label&gt;
        &lt;input type&#x3D;&quot;checkbox&quot; id&#x3D;&quot;affect-green&quot; checked&gt;
        Green circle affected
      &lt;/label&gt;
      &lt;label&gt;
        &lt;input type&#x3D;&quot;checkbox&quot; id&#x3D;&quot;affect-blue&quot; checked&gt;
        Blue circle affected
      &lt;/label&gt;
    &lt;/form&gt;
    &lt;script&gt;
      // Create separate layers for red, green an blue circles.
      //
      // Every layer has one feature that is styled with a circle, together the
      // features form the corners of an equilateral triangle and their styles overlap
      var redLayer &#x3D; new ol.layer.Vector({
        source: new ol.source.Vector({
          features: [new ol.Feature(new ol.geom.Point([0, 0]))]
        }),
        style: new ol.style.Style({
          image: new ol.style.Circle({
            fill: new ol.style.Fill({
              color: &#x27;rgba(255,0,0,0.8)&#x27;
            }),
            stroke: new ol.style.Stroke({
              color: &#x27;rgb(255,0,0)&#x27;,
              width: 15
            }),
            radius: 120
          })
        })
      });
      var greenLayer &#x3D; new ol.layer.Vector({
        source: new ol.source.Vector({
          // 433.013 is roughly 250 * Math.sqrt(3)
          features: [new ol.Feature(new ol.geom.Point([250, 433.013]))]
        }),
        style: new ol.style.Style({
          image: new ol.style.Circle({
            fill: new ol.style.Fill({
              color: &#x27;rgba(0,255,0,0.8)&#x27;
            }),
            stroke: new ol.style.Stroke({
              color: &#x27;rgb(0,255,0)&#x27;,
              width: 15
            }),
            radius: 120
          })
        })
      });
      var blueLayer &#x3D; new ol.layer.Vector({
        source: new ol.source.Vector({
          features: [new ol.Feature(new ol.geom.Point([500, 0]))]
        }),
        style: new ol.style.Style({
          image: new ol.style.Circle({
            fill: new ol.style.Fill({
              color: &#x27;rgba(0,0,255,0.8)&#x27;
            }),
            stroke: new ol.style.Stroke({
              color: &#x27;rgb(0,0,255)&#x27;,
              width: 15
            }),
            radius: 120
          })
        })
      });

      // Create the map, the view is centered on the triangle. Zooming and panning is
      // restricted to a sane area
      var map &#x3D; new ol.Map({
        layers: [
          redLayer,
          greenLayer,
          blueLayer
        ],
        target: &#x27;map&#x27;,
        view: new ol.View({
          center: [250, 220],
          extent: [0, 0, 500, 500],
          resolution: 4,
          minResolution: 2,
          maxResolution: 32
        })
      });

      // Get the form elements and bind the listeners
      var select &#x3D; document.getElementById(&#x27;blend-mode&#x27;);
      var affectRed &#x3D; document.getElementById(&#x27;affect-red&#x27;);
      var affectGreen &#x3D; document.getElementById(&#x27;affect-green&#x27;);
      var affectBlue &#x3D; document.getElementById(&#x27;affect-blue&#x27;);


      /**
       * This method sets the globalCompositeOperation to the value of the select
       * field and it is bound to the precompose event of the layers.
       *
       * @param {ol.render.Event} evt The render event.
       */
      var setBlendModeFromSelect &#x3D; function(evt) {
        evt.context.globalCompositeOperation &#x3D; select.value;
      };


      /**
       * This method resets the globalCompositeOperation to the default value of
       * &#x27;source-over&#x27; and it is bound to the postcompose event of the layers.
       *
       * @param {ol.render.Event} evt The render event.
       */
      var resetBlendModeFromSelect &#x3D; function(evt) {
        evt.context.globalCompositeOperation &#x3D; &#x27;source-over&#x27;;
      };


      /**
       * Bind the pre- and postcompose handlers to the passed layer.
       *
       * @param {ol.layer.Vector} layer The layer to bind the handlers to.
       */
      var bindLayerListeners &#x3D; function(layer) {
        layer.on(&#x27;precompose&#x27;, setBlendModeFromSelect);
        layer.on(&#x27;postcompose&#x27;, resetBlendModeFromSelect);
      };


      /**
       * Unind the pre- and postcompose handlers to the passed layers.
       *
       * @param {ol.layer.Vector} layer The layer to unbind the handlers from.
       */
      var unbindLayerListeners &#x3D; function(layer) {
        layer.un(&#x27;precompose&#x27;, setBlendModeFromSelect);
        layer.un(&#x27;postcompose&#x27;, resetBlendModeFromSelect);
      };


      /**
       * Handler for the click event of the &#x27;affect-XXX&#x27; checkboxes.
       *
       * @this {HTMLInputElement}
       */
      var affectLayerClicked &#x3D; function() {
        var layer;
        if (this.id &#x3D;&#x3D; &#x27;affect-red&#x27;) {
          layer &#x3D; redLayer;
        } else if (this.id &#x3D;&#x3D; &#x27;affect-green&#x27;) {
          layer &#x3D; greenLayer;
        } else {
          layer &#x3D; blueLayer;
        }
        if (this.checked) {
          bindLayerListeners(layer);
        } else {
          unbindLayerListeners(layer);
        }
        map.render();
      };


      // Rerender map when blend mode changes
      select.addEventListener(&#x27;change&#x27;, function() {
        map.render();
      });

      // Unbind / bind listeners depending on the checked state when the checkboxes
      // are clicked
      affectRed.addEventListener(&#x27;click&#x27;, affectLayerClicked);
      affectGreen.addEventListener(&#x27;click&#x27;, affectLayerClicked);
      affectBlue.addEventListener(&#x27;click&#x27;, affectLayerClicked);

      // Initially bind listeners
      bindLayerListeners(redLayer);
      bindLayerListeners(greenLayer);
      bindLayerListeners(blueLayer);
    &lt;/script&gt;
  &lt;/body&gt;
&lt;/html&gt;</code></pre>
      </div>
    </div>

    <script src="./resources/common.js"></script>
    <script src="./resources/prism/prism.min.js"></script>
    <script src="loader.js?id=blend-modes"></script>
  </body>
  <script>
  var packageUrl = 'https://raw.githubusercontent.com/openlayers/openlayers.github.io/build/package.json';
  fetch(packageUrl).then(function(response) {
    return response.json();
  }).then(function(json) {
    var latestVersion = json.version;
    document.getElementById('latest-version').innerHTML = latestVersion;
    var url = window.location.href;
    var branchSearch = url.match(/\/([^\/]*)\/examples\//);
    var cookieText = 'dismissed=-' + latestVersion + '-';
    var dismissed = document.cookie.indexOf(cookieText) != -1;
    if (!dismissed && /^v[0-9\.]*$/.test(branchSearch[1]) && '4.6.5' != latestVersion) {
      var link = url.replace(branchSearch[0], '/latest/examples/');
      fetch(link, {method: 'head'}).then(function(response) {
        var a = document.getElementById('latest-link');
        a.href = response.status == 200 ? link : '../../latest/examples/';
      });
      var latestCheck = document.getElementById('latest-check');
      latestCheck.style.display = '';
      document.getElementById('latest-dismiss').onclick = function() {
        latestCheck.style.display = 'none';
        document.cookie = cookieText;
      }
    }
  });
  </script>
</html>
